﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class UsersDetails : System.Web.UI.UserControl
{
    BusinessLogic obj_business = new BusinessLogic();
    protected void Page_Load(object sender, EventArgs e)
    {
        DataTable dt = obj_business.getuserdetails(Convert.ToInt32(Request.QueryString["userid"].ToString()));

        txtAcountno.Text = dt.Rows[0]["account_no"].ToString();
        txtAddress.Text = dt.Rows[0]["address"].ToString();
        txtBankname.Text = dt.Rows[0]["bankname"].ToString();
        txtEmailid.Text = dt.Rows[0]["email_id"].ToString();
        txtMobileno.Text = dt.Rows[0]["account_no"].ToString();
        txtname.Text = dt.Rows[0]["name"].ToString();
        lblUsertype.Text = dt.Rows[0]["user_type"].ToString();

    }
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        txtAcountno.ReadOnly = false;
        txtAddress.ReadOnly = false;
        txtBankname.ReadOnly = false;
        txtEmailid.ReadOnly = false;
        txtMobileno.ReadOnly = false;
        txtname.ReadOnly = false;
    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        string accountno = txtAcountno.Text.ToString();
        string name = txtname.Text.ToString();
        string Email = txtEmailid.Text.ToString();
        long mobile = Convert.ToInt64(txtMobileno.Text.ToString());
        string bankname = txtBankname.Text.ToString();
        string address = txtAddress.Text.ToString();
        int uid = Convert.ToInt32(Request.QueryString["userid"].ToString());

        if (obj_business.updateuserdetails(uid, accountno, name, Email, mobile, bankname, address))
        {

        }
        else
        {
            Response.Write("error");
        }
    }
}